coords_proto = [
    [0, 1, 2, 3, 4, 5, 6, 7, 128, 129, 130, 131, 132, 133, 134, 135],
    [15, 14, 13, 12, 11, 10, 9, 8, 143, 142, 141, 140, 139, 138, 137, 136],
    [16, 17, 18, 19, 20, 21, 22, 23, 144, 145, 146, 147, 148, 149, 150, 151],
    [31, 30, 29, 28, 27, 26, 25, 24, 159, 158, 157, 156, 155, 154, 153, 152],
    [32, 33, 34, 35, 36, 37, 38, 39, 160, 161, 162, 163, 164, 165, 166, 167],
    [47, 46, 45, 44, 43, 42, 41, 40, 175, 174, 173, 172, 171, 170, 169, 168],
    [48, 49, 50, 51, 52, 53, 54, 55, 176, 177, 178, 179, 180, 181, 182, 183],
    [63, 62, 61, 60, 59, 58, 57, 56, 191, 190, 189, 188, 187, 186, 185, 184],
    [64, 65, 66, 67, 68, 69, 70, 71, 192, 193, 194, 195, 196, 197, 198, 199],
    [79, 78, 77, 76, 75, 74, 73, 72, 207, 206, 205, 204, 203, 202, 201, 200],
    [80, 81, 82, 83, 84, 85, 86, 87, 208, 209, 210, 211, 212, 213, 214, 215],
    [95, 94, 93, 92, 91, 90, 89, 88, 223, 222, 221, 220, 219, 218, 217, 216],
    [96, 97, 98, 99, 100, 101, 102, 103, 224, 225, 226, 227, 228, 229, 230, 231],
    [111, 110, 109, 108, 107, 106, 105, 104, 239, 238, 237, 236, 235, 234, 233, 232],
    [112, 113, 114, 115, 116, 117, 118, 119, 240, 241, 242, 243, 244, 245, 246, 247],
    [127, 126, 125, 124, 123, 122, 121, 120, 255, 254, 253, 252, 251, 250, 249, 248]
]

# generated with
# list(zip(*[[((a * y) + x) if y % 2 == 0 else (((a * (y + 1)) - 1) - x) for x in range(a)] for y in range(a)]))
coords = [
    [0, 31, 32, 63, 64, 95, 96, 127, 128, 159, 160, 191, 192, 223, 224, 255],
    [1, 30, 33, 62, 65, 94, 97, 126, 129, 158, 161, 190, 193, 222, 225, 254],
    [2, 29, 34, 61, 66, 93, 98, 125, 130, 157, 162, 189, 194, 221, 226, 253],
    [3, 28, 35, 60, 67, 92, 99, 124, 131, 156, 163, 188, 195, 220, 227, 252],
    [4, 27, 36, 59, 68, 91, 100, 123, 132, 155, 164, 187, 196, 219, 228, 251],
    [5, 26, 37, 58, 69, 90, 101, 122, 133, 154, 165, 186, 197, 218, 229, 250],
    [6, 25, 38, 57, 70, 89, 102, 121, 134, 153, 166, 185, 198, 217, 230, 249],
    [7, 24, 39, 56, 71, 88, 103, 120, 135, 152, 167, 184, 199, 216, 231, 248],
    [8, 23, 40, 55, 72, 87, 104, 119, 136, 151, 168, 183, 200, 215, 232, 247],
    [9, 22, 41, 54, 73, 86, 105, 118, 137, 150, 169, 182, 201, 214, 233, 246],
    [10, 21, 42, 53, 74, 85, 106, 117, 138, 149, 170, 181, 202, 213, 234, 245],
    [11, 20, 43, 52, 75, 84, 107, 116, 139, 148, 171, 180, 203, 212, 235, 244],
    [12, 19, 44, 51, 76, 83, 108, 115, 140, 147, 172, 179, 204, 211, 236, 243],
    [13, 18, 45, 50, 77, 82, 109, 114, 141, 146, 173, 178, 205, 210, 237, 242],
    [14, 17, 46, 49, 78, 81, 110, 113, 142, 145, 174, 177, 206, 209, 238, 241],
    [15, 16, 47, 48, 79, 80, 111, 112, 143, 144, 175, 176, 207, 208, 239, 240]
]